
import threading , time, signal
import sys
import datetime

from win10toast import  ToastNotifier


def printA():
    while True:
        ts = datetime.datetime.now().strftime('%Y.%m.%d-%H:%M:%S')
        print(ts)
        time.sleep(1)

def printB():
    while True:
        print('B')
        time.sleep(1)

def quit(signum, frame):
    sys.exit()

if __name__ == '__main__':
    toaster = ToastNotifier()
    toaster.show_toast("价格提醒", "君正集团  5.610      6.170      9.98%", duration=10)

    try:
        signal.signal(signal.SIGINT, quit)
        signal.signal(signal.SIGTERM, quit)

        a = threading.Thread(target=printA)
        b = threading.Thread(target=printB)

        a.setDaemon(True)
        b.setDaemon(True)

        a.start()
        b.start()
        while True:
            pass
    except Exception as exc:
        # toaster = ToastNotifier()
        # toaster.show_toast("价格提醒", exc, duration=10)
        # print(exc)
        pass



